1. Field of the Invention
This invention relates to an outline smoothing method and system suitable for use in a character-outputting device which has bitmapped fonts, such as a printing device and a display device of a tape printing apparatus, a word processor, or a personal computer.
2. Prior Art
Conventionally, characters of various sizes have been printed or displayed by one of the following methods (1) to (3):
(1) a method of storing data of all character fonts to be printed or displayed;
(2) a method of storing and scaling (enlarging/reducing) bitmapped fonts; and
(3) a method of storing and scaling (enlarging/reducing) outline fonts.
However, the method (1) requires a huge amount of data, and hence it is not practical.
As far as the method (2) is concerned, the print quality obtained by this method is inferior to that obtained by the method (1), and the attempt to solve the problem burdens a processor with increased software-based processing, which takes much time.
More specifically, to improve print quality, a printing device using a bitmap font carries out smoothing of xe2x80x9cstairstepsxe2x80x9d of the outline of an enlarged character image. A xe2x80x9cstairstepxe2x80x9d here means a portion of the outline of a character image, which appears stepped due to lack of bit map data for a diagonally adjacent portion between diagonally arranged dots, and develops a break or corrupted portion with enlargement of the character image.
For smooth outlines of character images, it has been conventionally carried out to detect such xe2x80x9cstairstepsxe2x80x9d, and when the character images are enlarged, correction dots are added to infill the xe2x80x9cstairstepsxe2x80x9d.
However, in the smoothing processing, if correction dots are increased in number, the contour of a character looses its shape to spoil the design of the character, whereas if the number of correction dots is reduced, jaggies remain noticeable on the outline of the character, so that as the scaling factor is larger, the correction of the image becomes less effective.
The method (3) requires a larger system size and a larger amount of data than the method (2), so that in a printing apparatus of a relatively small size, such as a tape printing apparatus, this method can be employed at the cost of either an increased processing time or an increased market price.
It is an object of the invention to provide an outline smoothing method, system and storage medium that enables a character image of a bitmapped font having an outline which looks smooth even when the character image is enlarged by a large scaling factor.
To attain the above object, according to a first aspect of the present invention, there is provided a method of smoothing an outline of a character image of a bitmapped font defined by bitmap data in a dot matrix format, the method comprising the steps of:
converting the bitmap data temporarily to vector data when the character image is expanded;
drawing lines on a new bitmap based on a sequence of a predetermined number of vectors, the sequence being shifted, one vector by one vector, from a start of the vector data to an end of the vector data, to thereby form an outline of the enlarged character image; and
filling an inside of the outline with dots to thereby produce new bitmap data representative of the enlarged character image.
Preferably, the step of drawing lines includes the steps of:
determining basic outline coordinate points, based on the vector data;
correcting the basic outline coordinate points with reference to correction data defined in advance in a manner corresponding to respective patterns of variation in the sequence of the predetermined number of vectors, to thereby form corrected outline coordinate points; and
connecting between each pair of adjacent ones of the corrected outline coordinate points by a line.
To attain the above object, according to a second aspect of the invention, there is provided a method of smoothing an outline of a character image of a bitmapped font defined by bitmap data in a dot matrix format, the method comprising the steps of:
determining coordinates of a starting point of the bitmap data, according to predetermined conditions, the starting point being associated with a start of vector data into which the bitmap data is converted, while referring to vectorized dot information indicative of whether or not each dot of the bitmap data has been vectorized;
converting the bitmap data to an orthogonal vector sequence by sequentially determining a direction of each adjacent dot of the bitmap data which is located next to a corresponding preceding dot, starting from the starting point, according to a predetermined order, and converting the each adjacent dot of the bitmap data into a vector of a direction of any of upward, downward, leftward, and rightward directions, with reference to the determined direction, while at the same time updating the vectorized dot information;
converting the orthogonal vector sequence to a diagonal vector sequence based on each sequence of a predetermined number of vectors of the orthogonal vector sequence, with reference to a diagonalization table defining in advance predetermined patterns of the each of sequence which is to be applied for converting a vector of the diagonal vector sequence to a diagonal vector;
carrying out line-drawing processing by producing bitmap coordinate points based on the starting point and the diagonal vector sequence and correcting the bit map coordinate points with reference to a correction data table defining in advance amounts of correction in units of dots in a manner associated with respective patterns of each sequence of a predetermined number of vectors of the diagonal vector sequence;
causing aforementioned steps to be repeatedly carried out until the step of determining the coordinates of a starting point can determine no more starting point, to thereby produce line data representative of results of the line-drawing processing; and
producing new bitmap data based on the line data.
Preferably, the step of carrying out line-drawing processing includes producing data defining an outline of the character image and data defining a line for filling an inside thereof with dots by filling processing, and the step of producing new bit map data comprises the steps of:
carrying out the filling processing;
superposing data obtained by the filling processing and the data defining the outline one upon another; and
carrying out stroke width-reducing processing for reducing a stroke width of the character image increased due to the vectorization.
Preferably, the step of determining coordinates of the starting point includes scanning dots of the bitmap data sequentially in a predetermined direction, and determining, as the coordinates of the starting point, coordinates of a dot which is not indicated to be vectorized by the vectorized dot information, and at the same time, shows a change from its immediately preceding dot.
Preferably, the step of converting the bitmap data to an orthogonal vector sequence comprises the steps of:
setting a vector value corresponding to the starting point and updating the vectorized dot information such that the starting point is vectorized;
shifting a dot position for vectorization to a next dot in a vector direction;
checking dots around the next dot to thereby determine a vector value of the next dot;
updating the vectorized information such that a dot corresponding to the shifted dot position is vectorized if the dot corresponding to the shifted dot position can be a candidate for the starting point; and
repeatedly executing the aforementioned step of shifting the dot position to the aforementioned step of updating the vectorized dot information until the dot position for vectorization returns to the starting point.
Preferably, the step of carrying out line-drawing processing includes the steps of:
determining a starting coordinate point of a basic outline before correction, based on the starting point, according to predetermined conditions, and then determining each following coordinate point by adding, to a corresponding immediately preceding coordinate point, a shift amount determined based on a value of a vector of the diagonal vector sequence corresponding to the corresponding immediately preceding coordinate point, to thereby set basic outline coordinate points; and
correcting the basic outline coordinate points with reference to the correction data table to thereby generate outline coordinate points.
More preferably, the step of carrying out line-drawing processing further includes the steps of:
producing data defining an outline of the character image by connecting between each successive two of the outline coordinate points by setting dots to a starting point, an ending point, and interpolation points at respective coordinate points which are closest to a straight line between the each successive two of the outline coordinate points and whose coordinates are integers, with one of two orthogonal coordinate axes of a coordinate system of the outline coordinate points being set to a reference axis, the one of the two orthogonal coordinate axes being an axis along which the straight line indicates a larger change in coordinate values than along another of the two orthogonal coordinate axes in dependence on a slope of the straight line; and
producing data defining a line for filling an inside thereof with dots by connecting between the each successive two of the outline coordinate points by setting dots to the starting point and the interpolation points, with only a predetermined one of the two orthogonal coordinate axes of the coordinate system being set to a reference axis.
More preferably, the step of superposing data obtained by the filling processing and the data defining the outline one upon another includes performing a logical OR operation of the data obtained by the filling processing and the data defining the outline.
More preferably, the step of carrying out stroke width-reducing processing comprises the step of scanning coordinate points of superposed bitmap data obtained by the superposition of the data obtained by the filling processing and the data defining the outline in a vertical direction to make a present dot white when the present dot is black and at the same time an immediately following dot is white, and scanning the coordinate points of the superposed bitmap data in a horizontal direction to make a present dot white when the present dot is black and at the same time an immediately following dot is white, thereby deleting dots corresponding to a one-doth width in each of the vertical direction and the horizontal direction from the superposed bitmap data representative of the character image having vertical and horizontal widths thereof increased by one dot due to the vectorization.
To attain the above object, according to a third aspect of the invention, there is provided an outline smoothing system comprising:
a storage device for storing bit map data in a dot matrix format defining a bitmapped font;
a font processing device for converting the bitmap data temporarily to vector data when a character image of the bitmapped font is expanded, drawing lines on a new bitmap based on a sequence of a predetermined number of vectors, the sequence being shifted, one vector by one vector, from a start of the vector data to an end of the vector data, to thereby form an outline of the enlarged character image, and filling an inside of the outline with dots to thereby produce new bitmap data representative of the enlarged character image; and
a character output device for printing or displaying the new bit map data.
More preferably, the font processing device comprises:
a basic outline-calculating section for determining basic outline coordinate points, based on the vector data; and
a line segment-generating section for correcting the basic outline coordinate points with reference to a correction table defining correction data defined in advance in a manner corresponding to respective patterns of variation in the sequence of the predetermined number of vectors, to thereby form corrected outline coordinate points, and connecting between each pair of adjacent ones of the corrected outline coordinate points by a line.
To attain the above object, according to a fourth aspect of the invention, there is provided an outline smoothing system for a character output apparatus that prints or displays based on bitmap data, comprising:
a storage device for storing bit map data in a dot matrix format defining a bitmapped font;
a starting point-determining section for determining coordinates of a starting point of the bitmap data, according to predetermined conditions, the starting point being associated with a start of vector data into which the bitmap data is converted, while referring to vectorized dot information indicative of whether or not each dot of the bitmap data has been vectorized;
an orthogonal vector sequence-extracting section for converting the bitmap data to an orthogonal vector sequence by sequentially determining a direction of each adjacent dot of the bitmap data which is located next to a corresponding preceding dot, starting from the starting point, according to a predetermined order, and converting the each adjacent dot of the bitmap data into a vector of a direction of any of upward, downward, leftward, and rightward directions, with reference to the determined direction, while at the same time updating the vectorized dot information;
a diagonal-vectorization section for converting the orthogonal vector sequence to a diagonal vector sequence based on each sequence of a predetermined number of vectors of the orthogonal vector sequence, with reference to a diagonalization table defining in advance predetermined patterns of the each of sequence which is to be applied for converting a vector of the diagonal vector sequence to a diagonal vector;
a line-drawing section for carrying out line-drawing processing by producing bitmap coordinate points based on the starting point and the diagonal vector sequence and correcting the bit map coordinate points with reference to a correction data table defining in advance amounts of correction in units of dots in a manner associated with respective patterns of each sequence of a predetermined number of vectors of the diagonal vector sequence; and
a bitmap data-producing section for producing new bitmap data based on line data representative of results of the line-drawing processing, the line data being formed by execution of processing of aforementioned sections until the starting point-determining section can determine no more starting point.
Preferably, the line-drawing sections includes an outline data-producing section for producing data defining an outline of the character image, and a filling line data-producing section for producing data defining a line for filling an inside thereof with dots by filling processing, and wherein the bitmap data-producing section includes a filling section for carrying out the filling processing, a superposing section for superposing data obtained by the filling processing and the data defining the outline one upon another, and a stroke width-correcting section carrying out stroke width-reducing processing for reducing a stroke width of the character image increased due to the vectorization.
Preferably, the correction data table comprises a plurality of tables of correction data prepared in advance respectively for a plurality of bitmapped fonts, for being selectively dependent on a selected one of the plurality of bitmapped fonts.
To attain the above object, according to a fifth aspect of the invention, there is provided a storage medium storing a program that can be executed by a computer, the program being capable of realizing a method of smoothing an outline of a character image of a bitmapped font defined by bitmap data in a dot matrix format, the program comprising:
a vector data-producing module for converting the bitmap data temporarily to vector data when the character image is expanded;
an outline-forming module for drawing lines on a new bitmap based on a sequence of a predetermined number of vectors, the sequence being shifted, one vector by one vector, from a start of the vector data to an end of the vector data, to thereby form an outline of the enlarged character image; and
a new bitmap data-producing module for filling an inside of the outline with dots to thereby produce new bitmap data representative of the enlarged character image.
To attain the above object, according to a six aspect of the invention there is provided a storage medium storing a program that can be executed by a computer, the program being capable of realizing a method of smoothing an outline of a character image of a bitmapped font defined by bitmap data in a dot matrix format, the program comprising:
a starting point-determining module for determining coordinates of a starting point of the bitmap data, according to predetermined conditions, the starting point being associated with a start of vector data into which the bitmap data is converted, while referring to vectorized dot information indicative of whether or not each dot of the bitmap data has been vectorized;
an orthogonal vector sequence-extracting module for converting the bitmap data to an orthogonal vector sequence by sequentially determining a direction of each adjacent dot of the bitmap data which is located next to a corresponding preceding dot, starting from the starting point, according to a predetermined order, and converting the each adjacent dot of the bitmap data into a vector of a direction of any of upward, downward, leftward, and rightward directions, with reference to the determined direction, while at the same time updating the vectorized dot information;
a diagonal-vectorization module for converting the orthogonal vector sequence to a diagonal vector sequence based on each sequence of a predetermined number of vectors of the orthogonal vector sequence, with reference to a diagonalization table defining in advance predetermined patterns of the each of sequence which is to be applied for converting a vector of the diagonal vector sequence to a diagonal vector;
a line-drawing module for carrying out line-drawing processing by producing bitmap coordinate points based on the starting point and the diagonal vector sequence and correcting the bit map coordinate points with reference to a correction data table defining in advance amounts of correction in units of dots in a manner associated with respective patterns of each sequence of a predetermined number of vectors of the diagonal vector sequence;
a line data-producing module for causing aforementioned steps to be repeatedly carried out until the step of determining the coordinates of a starting point can determine no more starting point, to thereby produce line data representative of results of the line-drawing processing; and
a bitmap data-producing module for producing new bitmap data based on the line data.
According to the outline smoothing methods and systems and the storage mediums therefor, the bitmap data stored in a font memory is once converted to vector data, and smoothed by using the vector data. Therefore, even a character image of a bitmapped font is enlarged by a large scaling factor, bit map data which provides smooth outlines of character images can be formed. To this end, the bitmap is represented by vectors in e.g. eight directions (upward, downward, leftward, and rightward directions, and four diagonal directions), and based on a sequence of e.g. six vectors, an optimal vector direction is determined. Further, based on patterns of a sequence of six vectors, the outline of a character image which vectors cannot properly or suitably express is corrected in units of dots.
According to the present invention, it is not only possible to print high-quality character images even when they are enlarged, but also possible to effect data compression since the bitmap data is used. Depending on the size of characters, data compression algorithm based on arithmetic coding, it is possible to effect about 40% compression. Normally, even when apparatuses storing outline fonts, bitmap data is sometimes used to print a small character handled at a low resolution to avoid degradation of a print quality. According to the invention, irrespective of whether the size of characters is large or small, they can be printed with the same quality, and further the capacity of a memory can be saved.
Further, the invention can be applied not only to a printing device and a display device of word processors and personal computers (PCs), but also to apparatuses having a relatively small size, such as a tape printing apparatus, and thereby enable such apparatuses to form character images having smooth outlines by the outline smoothing when they are enlarged, without any cost of degraded print quality, slower processing speed, and price.
The above and other objects, features, and advantages of the invention will become more apparent from the following detailed description taken in conjunction with the accompanying drawings.